#ifndef EDIT_FORM_H
#define EDIT_FORM_H

#include <QWidget>
#include <QTimer>
#include <QVariant>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QTextStream>
#include "add_form.h"
#include <QDialog>
#include <QDir>
#include "smalltool.h"

enum State{
    State_Idle = 0,
    State_Add,
    State_Edit,
    State_Del,
};

namespace Ui {
class edit_form;
}

class edit_form : public QWidget
{
    Q_OBJECT

public:
    explicit edit_form(QWidget *parent = 0);
    ~edit_form();

    void showWidget();

public slots:
    void addData(QVariant data);

private slots:
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

signals:
    void sendParseResult(QVariant data, QMap<QString, int> name_to_id);
private:
    Ui::edit_form *ui;
    Add_Form* _add_form;
    QVariantList _inputList;
    State _state;    
    SmallTool* _smallTool;

    void init();
    void parseJson(QString data);
    void initListWidget();
    void saveData();


};

#endif // EDIT_FORM_H
